#!/usr/bin/perl

displayDir('E:\tmp\destdir');

sub displayDir {
  my $dir = shift;
  
  opendir(DIRHANDLE , $dir) || die "Open dir $dir error!: $!";
  my @files = grep {!/^\./} readdir(DIRHANDLE);
  closedir(DIRHANDLE) || die "Close dir $dir error!: $!";
  
  
  for $file (@files) {
    my $fullFileName = $dir . '/' . $file;
    if( -d $fullFileName ) {
      displayDir($fullFileName);
    } else {
      print "file:", $fullFileName, "\n";
    } 
  }  
}

